<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h2>lazy修饰符</h2>
      <!-- lazy修饰符就是将 onInput事件换成onChange事件 -->
      <input type="text" v-model.lazy="text1" />
      <p>{{ text1 }}</p>

      <hr />

      <h2>number修饰符</h2>
      <!-- 将表单的值转成数字类型 -->
      <input type="number" v-model.number="text2" />
      <p>{{ text2 }} - {{ typeof text2 }}</p>

      <hr />

      <h2>trim修饰符</h2>
      <!-- trim修饰符用于去除首尾空格 -->
      <input type="text" v-model.trim="text3" />
      <p>{{ text3 }}</p>
      <button @click="fn">btn</button>
    </div>

    <script src="../../Vue.js"></script>
    <script>
      new Vue({
        el: "#app",
        data: {
          text1: "",
          text2: 12,
          text3: "",
        },
        methods: {
          fn() {
            console.log(this.text3);
          },
        },
      });
    </script>
  </body>
</html>
